<template>
	<view>
		<view class="container">
			<view class="list" v-for="(item,key) in gold_list" :key="key">
				 <view class="bonus-box">
					 <view class="bonus-tit">
					 	{{item.desc}}
					 </view>
					 <view class="bonus-time">
					 	{{ utils.timeTodate('Y-m-d H:i', item.create_time*1000) }}
					 </view>
				 </view>
				 <view class="bonus-money">
					 {{item.money}}元宝
				 </view>
			</view>
			<view class="no_data" v-if="gold_list.length==0">暂无记录</view>
		</view>
	</view>
</template>

<script>
	import utils from '@/components/shoyu-date/utils.filter.js';
	export default {
		data() {
			return {
				gold_list:[],
				utils: utils,
				per:20,
				p:1,
				is_bottom:false
			}
		},
		onLoad() {
			var self = this;
			this.getGoldList();
			// #ifdef H5
			let share_time_line={
				title:self.$request.h5_share_name, // 分享标题
				link: self.$request.h5_share_url+'?page=index', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
			}
			let share_app_message={
				title: self.$request.h5_share_name, // 分享标题
				desc: '我发现了一个很不错的商城，买家具有超大实惠！', // 分享描述
				link: self.$request.h5_share_url+'?page=index', // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
				imgUrl: self.$request.h5_img_url+'/static/images/logo.png', // 分享图标
			}
			uni.setStorageSync('share_time_line',share_time_line);
			uni.setStorageSync('share_app_message',share_app_message);
			self.$request.wx_config()
			// #endif
		},
		onShareAppMessage(res) {
		    if (res.from === 'button') {
		      console.log(res.target)
		    }
		    return {
		      title: this.$request.share_title,
		      path: '/pages/index/index'
		    }
		  },
		methods: {
			onReachBottom(){
				if(this.is_bottom) return;
				this.is_bottom = true;
				this.p++;
				this.getGoldList();
			},
			getGoldList(){
				var self = this;
				self.$request.request({
					url:'/user/vm_records',
					data:{
						p:self.p,
						per:self.per
					},
					success:function(res){
						if(res.code==200){
							var  y = res.result;
							self.gold_list = self.gold_list.concat(y);
							self.is_bottom = false;
						}else{
							
						}
					}
				});
			}
		}
	}
</script>

<style>
.container{
	display: flex;
	flex-direction: column;
	width: 95%;
	margin-left: 2.5%;
}
.list{
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	border-bottom: 1px solid #EEEEEE;
	padding: 20upx 0;
}
.bonus-box{
	display: flex;
	flex-direction: column;
}
.bonus-tit{
	font-size: 14px;
}
.bonus-msg{
	color: #b6b6b6;
	font-size: 14px;
}
.bonus-time{
	color: #666666;
	font-size: 12px;
}
.bonus-money{
	align-self: center;
}
.no_data{
	text-align: center;padding-top:50upx ;
}
</style>
